package com.qf.springcloud.factory;

import com.qf.springcloud.client.AirSearchClient;
import com.qf.springcloud.fallback.AirSearchClientFallback;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AirSearchClientFallbackFactory implements FallbackFactory<AirSearchClient> {

    @Autowired
    private AirSearchClientFallback airSearchClientFallback;

    @Override  // 返回Fallback对象
    public AirSearchClient create(Throwable cause) {
        // 打印异常信息
        cause.printStackTrace();
        return airSearchClientFallback;
    }
}
